extends NodeState


@export var gun: Gun


var velocity: Vector2


func _on_process(delta : float) -> void:
	process_movement(delta)



func _on_enter() -> void:
	gun.damageEmitter.set_deferred("monitoring", true)
	velocity = gun.direction * gun.speed
	gun.flip_sprite()
	gun.animationPlayer.play(Collectible.ANIMATION_FLY)


func _on_exit() -> void:
	gun.damageEmitter.set_deferred("monitoring", false)
	velocity = Vector2.ZERO


func process_movement(delta : float):
	gun.position += velocity * delta
